package com.gszy.auth.security;

import java.util.ArrayList;
import java.util.List;

/**
 * @author MeUChT
 */
public class ExcludedUrlConfiguration {

    /**
     * 准备不需要拦截的请求列表
     */
    private final List<String> exclude = new ArrayList<>();
    //----------------单例模式-----------------------------------
    private ExcludedUrlConfiguration(){

    }
    private static final ExcludedUrlConfiguration excludedUrlConfiguration = new ExcludedUrlConfiguration();

    public static ExcludedUrlConfiguration getInstance(){
        return excludedUrlConfiguration;
    }
    //----------------------------------------------------------

    /**
     * 添加不需要拦截的请求
     * @param url
     */
    public void addExcludedUrl(String url){
        exclude.add(url);

    }

    /**
     * 验证实际请求是否需要拦截
     * @param url
     * @return
     */
    public boolean isUrlExcluded(String url){

        return exclude.contains(url);
    }


}
